package com.example.demo2.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Description : 类描述
 * Created by cyd on 2021-05-10 23:28:56
 */
public class MyInsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 告诉浏览器，按照html的文本格式来解析
        resp.setContentType("text/html");
        // 告诉浏览器，使用UTF-8字符集解析
        resp.setCharacterEncoding("UTF-8");

        String result = "hello<br/>world";
        String result2 = "你好<br/>世界";
        PrintWriter out = resp.getWriter();
        out.print(result);
        out.print(result2);
    }
}
